﻿<%@ page language="java" pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
    String hrefFlag = request.getParameter("hrefFlag");
    hrefFlag = hrefFlag == null ? "" : hrefFlag;
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
    <base href="<%=basePath%>">

    <title>莫愁杂志社电商平台</title>
    <%@ include file="/pages/mainPage/header.jsp" %>

    <style type="text/css">
        body {
            margin-left: auto;
            margin-right: auto;
            width: 99%;
            padding-top: 10px;
            padding-left: 0px;
        }

        .icon-caret-down {
            white-space: nowrap;
        }

        .icon-caret-down:before {
            content: "\f0d7";
        }

        .tipDiv {
            margin-left: auto;
            margin-right: auto;
            padding-top: 5px;
            width: 96%;
            height: 28px;
            line-height: 28px;
            color: #999;
            font-size: 16px;
            text-align: left;
        }

        .tipDiv1 {
            width: 25%;
            float: left;
        }

        .tipDiv2 {
            width: 75%;
            float: left;
        }

        /*定义滚动条高宽及背景 高宽分别对应横竖滚动条的尺寸*/
        ::-webkit-scrollbar {
            width: 10px;
            height: 10px;
            background-color: #f1f1f1;
        }

        /*定义滚动条轨道 内阴影+圆角*/
        ::-webkit-scrollbar-track {
            -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);
        / / border-radius: 10 px;
            background-color: #f1f1f1;
        }

        /*定义滑块 内阴影+圆角*/
        ::-webkit-scrollbar-thumb {
        / / border-radius: 10 px;
            -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, .3);
            background-color: #d5d5d5;
        }

        .layer-anim {
            top: 200px !important;
        }
    </style>
</head>
<body id="corcenter_newl">
<div>
    <input type="hidden" id="finalDiscountMoney" name="finalDiscountMoney">
    <input type="hidden" id="sum_real_money" name="sum_real_money"/>
    <input type="hidden" id="finalDeliverMoney" name="finalDeliverMoney">
    <input type="hidden" id="finalDiscountOrderNo" name="finalDiscountOrderNo">
    <input type="hidden" id="refundType" name="refundType">
    <input type="hidden" id="refundOrderNo" name="refundOrderNo">
    <input type="hidden" id="refundOrderDetailUuid" name="refundOrderDetailUuid">
    <input type="hidden" id="rejectReason" name="rejectReason">
</div>
<div id="navigation">
    <div class="NewHead">
        <div class="NewNavBox">
            <div class="NewLogo">
                <img src="<%=path %>/include/images/logo/logo.png"
                     style="width:170px;height:50px;padding-left:10px;padding-top:5px;"/>
            </div>
            <div class="NewNavList" id="NewNavList">
                <ul>
                    <li class="tagLi" id="mainHome" class="NewCur"><em><a href="JavaScript:void('');"
                                                                          onclick="_queryLeftMenu('','','1','')"
                                                                          target="_self">首页</a></em></li>
                </ul>
            </div>
            <div id="ulDiv"
                 style="float:right;height:60px;line-height:60px;text-align:right;padding-right:20px;color:white;">
                <ul class="nav ace-nav pull-right">
                    <li class="light-red user-profile">
                        <a class="user-menu dropdown-toggle" href="javascript:;" data-toggle="dropdown">
                            <i>您好 <span id="userName"></span>(<span id="tipsCount">0</span>)</i>
                            <i class="icon-caret-down"></i>
                        </a>
                        <ul id="user_menu"
                            class="pull-right dropdown-menu dropdown-yellow dropdown-caret dropdown-closer">
                            <li style="display:none;"><a onclick="editShopInfo();" style="cursor:pointer;"><i
                                    class="icon-user"></i> 修改资料</a></li>
                            <li id="systemset" style="display:none;"><a onclick="editSys();" style="cursor:pointer;"><i
                                    class="icon-cog"></i> 系统设置</a></li>
                            <li class="divider" style="display:none;"></li>
                            <!--
                            <li><a href="javascript:void('');" target="_self" onclick="_showTips()"><i class="icon-envelope"></i>通知中心(<span id="tipsCount2" style="color:red;">0</span>)</a></li>
                             -->
                            <li><a href="<%=path %>/login/login_out.do" target="_self"><i class="icon-off"></i> 退出</a>
                            </li>
                        </ul>
                    </li>
                    <!--
                       <li class="light-red user-profile" >
                        <a class="user-menu dropdown-toggle" href="javascript:;" data-toggle="dropdown">
                               <i >工具</i>
                               <i class="icon-caret-down"></i>
                        </a>
                           <ul id="user_menu" class="pull-right dropdown-menu dropdown-yellow dropdown-caret dropdown-closer">
                            <li><a onclick="_setShortcut(this);" style="cursor:pointer;"><i class="icon-check"></i>设为快捷菜单</a></li>
                        </ul>
                       </li>
                        -->
                </ul>
            </div>
        </div>
    </div>
</div>
<div id="content" class="container-fluid" style="margin-bottom: 30px;">
    <div style="width:80%;text-align:center;display:block;overflow:hidden;margin-left: 10%;">
        <div style="width:0%;float:left;min-height:500px;" id="divLeft">
        </div>
        <div style="width:100%;float:left;height:auto;" id="divRight">
            <iframe name="rightFrame" id="rightFrame" src=""
                    style="overflow:hidden;height:auto;min-height:500px;width:100%;" frameborder="0"
                    scrolling="no"></iframe>
        </div>
    </div>
</div>
<div id="layer_notice" style="display:none;">
    <div class="tipDiv">
    </div>
</div>
</body>
<script type="text/javascript">
    var path = "<%=path%>";
    var hrefFlag = "<%=hrefFlag%>";
    $(document).ready(function () {
        _queryHeadMenuList();
        _getUserInfo();
        _queryTipsList();
        var value = false;
        jQuery(function ($) {
            $('#ulDiv').focus(function () {
                value = true;
            })
            $('#corcenter_newl').click(function () {
                if (value) {
                    value = false;
                } else {
                    _hide_side_menu();
                }
            });
        });
    });

    function _setLiClass(hrefFlag) {
        if (hrefFlag == "") {
            hrefFlag = "mainHome";
        }
        $(".NewNavList .tagLi").each(function () {
            if ($(this).attr("id") == hrefFlag) {
                $(this).addClass("NewCur");
            } else {
                $(this).removeClass("NewCur");
            }
        });
    }

    function _getUserInfo() {
        $.ajax({
            type: "post",
            url: path + "/login/getUserInfo.do",
            dataType: "json",
            success: function (data) {
                if (data.success) {
                    $("#userName").html(data.obj.userName);
                }
            }
        });
    }

    function _queryHeadMenuList() {
        $.ajax({
            type: "post",
            url: path + "/menuRight/queryMenuList.do",
            data: {menuType: 'menuHead'},
            dataType: "json",
            success: function (data) {
                if (data.success) {
                    var str = "";
                    var url = $("#rightFrame").attr("src");
                    if (data.obj.length > 0) {
                        var list = data.obj;
                        str += "<ul>";
                        for (var i = 0; i < list.length; i++) {
                            var IF_MAIN = list[i].IF_MAIN;
                            if (IF_MAIN == "1") {
                                url = list[i].RESOURCE_URL;
                                _queryLeftMenu(list[i].RESOURCE_CODE, list[i].MENU_ID, list[i].IF_MAIN, url);
                                hrefFlag = list[i].MENU_ID;
                            }
                            str += "<li class='tagLi' id='" + list[i].MENU_ID + "' ><em><a href=\"javascript:void('')\" onclick=\"_queryLeftMenu('" + list[i].RESOURCE_CODE + "','" + list[i].MENU_ID + "','" + list[i].IF_MAIN + "','" + url + "')\" target='_self' >" + list[i].RESOURCE_NAME + "</a></em></li>";
                        }
                        str += "</ul>";
                    } else {
                        _queryLeftMenu("", "", "1", url);
                    }
                    if (str != "") {
                        $("#NewNavList").html(str);
                    }
                    _setLiClass(hrefFlag);
                    if (url != "") {
                        var iframeUrl = $("#rightFrame").attr("src");
                        if (iframeUrl != url) {
                            _IframeGotoPage('rightFrame', url);
                        }
                    }
                }
            }
        });
    }

    function _queryLeftMenu(menuCode, menuId, ifMain, detailMenuId) {
        console.info('menuCode:' + menuCode);
        console.info('menuId:' + menuId);
        console.info('ifMain:' + ifMain);
        console.info('detailMenuId:' + detailMenuId);
        var menuType = "menuLeft";
        _setLiClass(menuId);
        $.ajax({
            type: "post",
            url: path + "/menuRight/queryMenuList.do",
            data: {
                menuType: menuType,
                resourceParent: menuCode,
                ifMain: ifMain
            },
            dataType: "json",
            success: function (data) {
                if (data.success) {
                    var str = "";
                    var firstMenu = "";
                    var list = data.obj;
                    if (ifMain == "1") {
                        if (data.obj.length > 0) {
                            str += "<div class='fastx-jump' id='fastJm' style='float:right;margin-top:10px;margin-right:10px;'>";
                            str += "<div class='ftup'></div>";
                            for (var i = 0; i < list.length; i++) {
                                str += "<a href=\"javascript:void('')\" target='_self' onclick=\"_shortcutGotoPage('" + list[i].RESOURCE_CODE + "','" + list[i].MAIN_MENU_ID + "','" + list[i].MENU_ID + "')\">" + list[i].RESOURCE_NAME + "</a>";
                            }
                            $("#divLeft").width("15%");
                            $("#divRight").width("85%");
                        } else {
                            $("#divLeft").width("0");
                            $("#divRight").width("100%");
                        }
                        var iframeUrl = $("#rightFrame").attr("src");
                        //if(iframeUrl!=detailMenuId){
                        _IframeGotoPage('rightFrame', detailMenuId);
                        //}
                    } else {
                        if (data.obj.length > 0) {
                            if (menuId == '106yxhd') {
                                $("#divLeft").width("15%");
                                $("#divRight").width("85%");
                                $("#rightFrame").css('min-height', '1100px');
                            } else {
                                $("#divLeft").width("20%");
                                $("#divRight").width("80%");
                            }
                            str += "<div class='NewLeft'>";
                            var menuCode = "";
                            var menuParent = "";
                            for (var i = 0; i < list.length; i++) {
                                var RESOURCE_CODE = list[i].RESOURCE_CODE;
                                var RESOURCE_PARENT = list[i].RESOURCE_PARENT;
                                var SHOW_DEFAULT = list[i].SHOW_DEFAULT;
                                if (i == 0) {
                                    str += "<div class='LeftBox'><h3>" + list[i].RESOURCE_NAME + "</h3>";
                                    str += "<dl>";
                                } else if (menuCode == RESOURCE_PARENT || menuParent == RESOURCE_PARENT) {
                                    var curClass = "";
                                    if (detailMenuId == list[i].MENU_ID) {
                                        curClass = "ddCur";
                                        firstMenu = list[i].MENU_ID;
                                    } else if (firstMenu == "" && SHOW_DEFAULT == "1") {
                                        curClass = "ddCur";
                                        firstMenu = list[i].MENU_ID;
                                    }
                                    str += "<dd id='" + list[i].MENU_ID + "' resourceUuid='" + list[i].RESOURCE_UUID + "' resourceCode='" + list[i].RESOURCE_CODE + "' class='" + curClass + "' ><a href=\"javascript:void('')\" target='_self' url='" + list[i].RESOURCE_URL + "' onclick=\"_IframeGotoPage('rightFrame','" + list[i].RESOURCE_URL + "')\">" + list[i].RESOURCE_NAME + "</a></dd>";
                                } else if (menuParent != RESOURCE_PARENT) {
                                    str += "</dl></div>";
                                    str += "<div class='LeftBox'><h3>" + list[i].RESOURCE_NAME + "</h3>";
                                    str += "<dl>";
                                }
                                if (i == list.length - 1) {
                                    str += "</dl></div>";
                                }
                                menuCode = RESOURCE_CODE;
                                menuParent = RESOURCE_PARENT;
                            }
                            str += "</div>";
                        }
                    }
                    $("#divLeft").html(str);
                    if (firstMenu != "") {
                        _gotoPages(firstMenu);
                    }
                }
            }
        });
    }

    function _shortcutGotoPage(menuCode, mainMenuId, menuId) {
        if (menuCode.length > 3) {
            menuCode = menuCode.substr(0, 3);
            _queryLeftMenu(menuCode, mainMenuId, "0", menuId);
        }
    }

    function _gotoPages(menuId) {
        $(".LeftBox dd").removeClass("ddCur");
        $("#" + menuId).addClass("ddCur");
        _IframeGotoPage('rightFrame', $("#" + menuId + " a").attr("url"));
    }

    function _setShortcut(obj) {
        var shortcut = $(".NewLeft .LeftBox .ddCur");
        if (shortcut.length > 0) {
            var resourceUuid = shortcut.attr("resourceUuid");
            var resourceCode = shortcut.attr("resourceCode");
            $.ajax({
                type: "post",
                url: path + "/menuRight/setShortcut.do",
                data: {
                    resourceUuid: resourceUuid,
                    resourceCode: resourceCode,
                },
                dataType: "json",
                success: function (data) {
                    if (data.success) {
                        swal("快捷菜单设置成功", "", "success");
                        obj.parentNode.parentNode.style.display = "none";
                        obj.parentNode.parentNode.parentNode.className = obj.parentNode.parentNode.parentNode.className.replace("open", "");
                    } else if (data.msg != '') {
                        swal("OMG", "快捷菜单设置失败!", "error");
                    }
                }
            })
        } else {
            swal("请选择需要设置的菜单!", "", "info");
        }
    }

    function _queryTipsList() {
        $.ajax({
            type: "post",
            url: path + "/tips/queryTipsList.do",
            data: {},
            dataType: "json",
            success: function (data) {
                if (data.success) {
                    var obj = data.obj;
                    if (obj.length > 0) {
                        var array = new Array();
                        var htmlStr = "<div class='tipDiv'>";
                        for (var i = 0; i < obj.length; i++) {
                            htmlStr += "<div style='width:100%' onclick=\"_showTips()\"><div class='tipDiv1'>" + obj[i].TIP_DATE + "</div><div class='tipDiv2'><p>" + obj[i].TIP_TITLE + " </p></div></div>";
                            array.push(obj[i].UUID);
                        }
                        htmlStr += "</div>";
                        $('#layer_notice').html(htmlStr);
                        var tipIds = array.join(",");

                        $("#tipsCount").html(obj.length);
                        $("#tipsCount2").html(obj.length);
                        _showUpdateTips(tipIds);
                    }
                } else if (data.msg != '') {
                }
            }
        });
    }

    function _showUpdateTips(tipIds) {
        layer.open({
            type: 1,
            title: "信息提醒",
//	  closeBtn: 0, //不显示关闭按钮
            shade: [0],
            shadeClose: true,
            area: ['400px', '290px'],
            offset: 'rb', //右下角弹出
            time: 10000, //2秒后自动关闭
            anim: 2,
            content: $('#layer_notice'),
            cancel: function () {
                layer.closeAll();
                $.ajax({
                    type: "post",
                    url: path + "/tips/readTips.do",
                    data: {
                        tipIds: tipIds
                    },
                    dataType: "json",
                    success: function (data) {
//				swal(data.success,"", "success");
                    }
                });
            }
        });
    }

    function _showTips() {
        _shortcutGotoPage('103001003', '103mainAccountManage', '103001003tipListPage');
        layer.closeAll();
    }

    function _setProPubVal(v1, v2, v3) {
        //$("#rightFrame").contents().find("#unitName").val(v1);
        $("#rightFrame").contents().find("#barCode").val(v2);
        //$("#rightFrame").contents().find("#unitCode").val(v3);
        $("#rightFrame").contents().find("#measuring").val(v1);
        $("#rightFrame").contents().find("#measuringNew").val(v3 + "#@" + v1);
    }
</script>
</html>